package com.cskaoyan.bean.vo;

import com.cskaoyan.bean.MarketStorage;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * @author Fyy
 * @since 2022/12/29 09:12
 */

@AllArgsConstructor
@NoArgsConstructor
@Data
public class StorageCreateData {

    /**
     * size : 75275
     * addTime : 2022-12-29 09:07:51
     * name : QQ图片20221209181318.jpg
     * updateTime : 2022-12-29 09:07:51
     * id : 537
     * type : image/jpeg
     * key : 8yq1t6rvh8y0zqm6cg00.jpg
     * url : http://182.92.235.201:8083/wx/storage/fetch/8yq1t6rvh8y0zqm6cg00.jpg
     */
    private Integer size;
    private Date addTime;
    private String name;
    private Date updateTime;
    private Integer id;
    private String type;
    private String key;
    private String url;

    public static StorageCreateData data(MarketStorage marketStorage) {
        StorageCreateData data = new StorageCreateData();
        data.setAddTime(marketStorage.getAddTime());
        data.setId(marketStorage.getId());
        data.setKey(marketStorage.getKey());
        data.setName(marketStorage.getName());
        data.setSize(marketStorage.getSize());
        data.setType(marketStorage.getType());
        data.setUpdateTime(marketStorage.getUpdateTime());
        data.setUrl(marketStorage.getUrl());
        return data;
    }
}
